/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unisinos.tga;

import java.util.ArrayList;

/**
 *
 * @author Douglas
 */
public class Tileset {

    /**
     *
     */
    protected ArrayList<Tile> tileset = new ArrayList<Tile>();

    public ArrayList<Tile> getTileset() {
        return tileset;
    }

    public void setTileset(ArrayList<Tile> tileset) {
        this.tileset = tileset;
    }

    public Tile getTile(int id) {

        for (Tile tile : tileset) {
            if (id == tile.getId()) {
                return tile;
            }
        }
        return null;
    }

    public void addTile(Tile novoTile) {
        int novoId = 0;
        for (Tile tile : tileset) {
            if (tile.getId() > novoId) {
                novoId = tile.getId();
            }
        }
        novoId++;
        novoTile.setId(novoId);
        tileset.add(novoTile);
    }

    public void addTile(Tile novoTile, int id) {
        novoTile.setId(id);
        tileset.add(novoTile);
    }
    
    public void removeTile(int indice) {
        tileset.remove(indice);
        
    }
}
